// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import vuex from 'vuex'
import 'mint-ui/lib/style.css';
import { Lazyload} from 'mint-ui';
import './assets/js/commonJs';



// Vue.use(MessageBox);
// Vue.$indicator = Vue.prototype.$indicator = Indicator;
// Vue.component(Indicator.name, Indicator);
// Vue.use(Lazyload, {
//   //图片按需加载
//   loading: 'https://av.wuyoufang.com:80/assets/img/logo.jpg'
// });
Vue.use(Lazyload);
import axios from 'axios';//引入文件
import store from './store/index';
import './assets/css/iconfont.css';
import './assets/css/common.css';


// import adaptive from "adaptive.js"
// adaptive.desinWidth = 750;
// adaptive.init();
// import BaiduMap from 'vue-baidu-map';
// Vue.use(BaiduMap, {
//   // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
//   ak: 'LkqrywvkyMRoPedm14X806HUaUX4z8Ax'
// });
//caf8537379210162c9e68282f467b676
// import AMap from 'vue-amap'
// Vue.use(AMap)
// AMap.initAMapApiLoader({
//   key: 'caf8537379210162c9e68282f467b676',
//   plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor']
// });
Vue.prototype.$http = axios;//将axios挂载到Vue实例中的$ajax上面,在项目中的任何位置通过this.$http使用
Vue.config.productionTip = false;
Vue.use(vuex);
// router.beforeEach((to, from, next) => {
//   // to 和 from 都是 路由信息对象
//   if (from.name)
//     console.log(from.name + 'from-----');
//     console.log(to.name + 'to-------');
//   // 这里的from.path就是上一步的url的hash值
//   localStorage.setItem('routerName',from.name);
//   store.state.routerName = from.name;
//   next()
// });
// router.beforeEach((to, from, next) => {
//   console.log(to.name,'tototottoototo');
//   console.log(from.name,'fromfromfromfromfromfromfrom');
//   console.log(next.name,'nextnextnextnextnextnextnext');
//   next()
// });
/**
 * 动态修改title
 * **/
//main.js里面的代码
router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面meta */
  if(to.meta.content){
    let head = document.getElementsByTagName('head');
    let meta = document.createElement('meta');
    meta.content = to.meta.content;
    head[0].appendChild(meta)
  }
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title;
  }
  // if(from.name === 'CityIndex'){
  //   if (to.name === 'Index'){
  //     to.meta.keepAlive = false;
  //     console.log(to,'totototototototototo')
  //   }
  // }
  next()
});


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
});
